<?

$temp = array_shift(datafetch_array('structmap', array('attr' => AA_VISIBLE, 'path' => '/'/*.context('lang')*/)));

while (!($temp['tag'] & PT_MAIN))
	$temp = array_shift($temp['data']);
	
if (is_array($DATA['mainmenu'] = $temp['data']) && sizeof($DATA['mainmenu'])) {

	?><ul id="nav" class="show"><?
	
	foreach($DATA['mainmenu'] as $id => $v) {
	
		$first = ($v['first']) ? ' first' : '';
		$last = ($v['last']) ? ' last' : '';
	
		if ($p = inCrumb($id)) { 
			?><li class="mm_<?=$v['keyword']?> incrumb<?=$first.$last?> <?=$p['last'] ? 'active' : ''?>"><?
	
			if ($p['last']) {
				?><strong><?=$v['name']?></strong><?
			} else { 
				?><a href="<?=$v['url']?>" title="<?=$v['name']?>" class="level1"><strong><?=$v['name']?></strong></a><? 
			} 
	
		} else {
			?><li class="mm_<?=$v['keyword']?><?=$first.$last?>"><a href="<?=$v['url']?>" title="<?=$v['name']?>" class="level1"><strong><?=$v['name']?></strong></a><?
		}
		
		
		if ($v['data']) {
		
			?><ul class="nav"><?
			
			foreach($v['data'] as $id2 => $v2) {
			
				if ($p2 = inCrumb($id2)) { 
					?><li class="incrumb2"><?
			
					if ($p2['last']) {
						?><strong><?=$v2['name']?></strong><?
					} else { 
						?><a href="<?=$v2['url']?>" title="<?=$v2['name']?>"><strong><?=$v2['name']?></strong></a><? 
					} 
			
				} else {
					?><li><a href="<?=$v2['url']?>" title="<?=$v2['name']?>"><strong><?=$v2['name']?></strong></a><?
				}
					
				?></li><?
				
			}
		
			?></ul><?
		
		}
			
		?></li><?
		
	}?>
	
	</ul><div class="clearer"></div>
	
<? } ?>